<template>
	<div>
		<van-list
			v-model="listLoading"
			:finished="listFinished"
			finished-text="没有更多了"
			@load="getList"
		>
			<div v-for="item in records" :key="item.id">
				<slot name="content" v-bind:data="item"></slot>
			</div>
		</van-list>
	</div>
</template>
<script>

export default {
	data () {
		return {
			records: [],
			listLoading: false,
			listFinished: false,

		}
	},
	methods: {
		async getList () {
        setTimeout(() => {
          for (let i = 0; i < 10; i++) {
            var vote = {};
            vote.name = 'name' + i
            vote.id = i
            this.records.push(vote)
          }
          this.listLoading = false
          console.log(this.records)
          // 数据全部加载完成
          if (this.records.length >= 9) {
            this.listFinished = true;
          }
        }, 1000)
    }
	}
}
</script>
<style scoped>
</style>
